<?php
# idxCMS Flat Files Content Management System v5.0
# Copyright (c) 2011-2016 Victor Nabatov greenray.spb@gmail.com
# Module POLLS: Poll template

die();?>

<!-- FOREACH $poll -->
<div class="poll">
    <!-- IF $poll.voited==TRUE -->
        <table>
            <tr><th colspan="2" class="center">$poll.question</th></tr>
            <!-- FOREACH $poll.answers -->
                <tr>
                    <td>$answers.answer</td>
                    <td class="result right">[$answers.voices]%</td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table>
                            <tr>
                                <td width="[$answers.voices]%" height="5" style="background:$answers.color;white-space:nowrap;"></td>
                                <td height="5" ></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            <!-- END -->
            <tr><td colspan="2" class="center">__Total votes__: $poll.total</td></tr>
        </table>
    <!-- ELSE -->
        <form name="poll" method="post" >
            <input type="hidden" name="poll" value="$poll.id" />
            <table>
                <tr><th colspan="2" class="center">$poll.question</th></tr>
                <!-- FOREACH $polls.answers -->
                    <tr>
                        <td class="center"><input type="radio" name="answer" value="$answers.id" /></td>
                        <td>$answers.answer</td>
                    </tr>
                <!-- END -->
            </table>
            <p class="center"><input type="submit" name="save" value="__Submit__" /></p>
        </form>
    <!-- END -->
    <div class="center"><a href="{MODULE}polls.archive">__Polls archive__</a></div>
</div>
<!-- END -->
